<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item label="姓名">
        <el-input v-model="queryParams.input" placeholder="请输入" />
      </el-form-item>
      <el-form-item label="员工状态" prop="status">
        <el-select
          v-model="queryParams.status"
          placeholder="请选择"
          clearable
          style="width: 240px"
        >
          <el-option
            v-for="dict in options"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="身份证号" prop="status">
        <el-input v-model="queryParams.input" placeholder="请输入" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button @click="handleAdd" size="mini">新增</el-button>
        <el-button @click="handleEdit" size="mini">编辑</el-button>
        <el-button @click="handleDelete" size="mini">删除</el-button>
        <el-button @click="handleDelete" size="mini">导入</el-button>
        <el-button @click="handleDelete" size="mini">删除</el-button>
        <el-button size="mini">复制</el-button>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="list" @row-click="rowSelect">
      <el-table-column label="行号" type="index" :index="indexMethod" width="80" />
      <el-table-column label="姓名" prop="roleName" />
      <el-table-column label="员工状态" prop="roleKey"  />
      <el-table-column label="变动次数" prop="roleSort" />
      <el-table-column label="性别" prop="roleSort" width="100" />
      <el-table-column label="身份证号" prop="roleSort" width="100" />
      <el-table-column label="学历" prop="roleSort" />
      <el-table-column label="政治面貌" prop="roleSort" />
      <el-table-column label="居住地址" prop="roleSort" />
      <el-table-column label="户籍地址" prop="roleSort" width="100" />
      <el-table-column label="手机号码" prop="roleSort" />
      <el-table-column label="紧急联系人" prop="roleSort" />
      <el-table-column label="紧急联系人电话" prop="roleSort" width="150" />
      <el-table-column label="备注" prop="roleSort" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-table style="margin-top: 40px;" v-loading="loading1" :data="list1">
      <el-table-column label="原单位名称" prop="qasd" />
      <el-table-column label="新入职单位" prop="roleName" />
      <el-table-column label="入职时间" prop="roleKey"  />
    </el-table>
  </div>
</template>

<script>
import { listRole } from "@/api/system/role";

export default {
  data() {
    return {
      // 下拉数据
      options: [],
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 表格数据
      list: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        roleName: undefined,
        status: undefined,
        num: undefined
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 序号计算
    indexMethod(index) {
      return (this.queryParams.pageNum- 1) * this.queryParams.pageSize + index + 1;
    },
    /** 查询角色列表 */
    getList() {
      this.loading = true;
      listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
          this.list = response.rows;
          this.total = response.total;
          this.loading = false;
        }
      );
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 表格行点击
    rowSelect(row) {
      this.loading1 = true
      this.list1 = []
      this.loading1 = false
    }
  }
};
</script>
